<?php

use Core\AdminController;
use Models\Item;

class ItemController extends AdminController
{

	public function index()
	{
		$item = new Item();
		$get = $this->input->get();
		if(!empty($get['product_id'])) {
			$item->where('product_id', $get['product_id']);
		}

		$items = $item->get();

		return $this->response($items);
	}

	public function get($product_id)
	{
		$item = new Item();

		$items = $item->where('product_id', $product_id)->get();

		return $this->response($items);
	}
}